package com.ihighest.app.infox.myview;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ihighest.app.infox.R;

public class ThiredTextItemView extends RelativeLayout {
	private TextView ThreeTextviewItem;
	private TextView centerItem;
	private TextView rightItem;

	public ThiredTextItemView(Context context, AttributeSet attrs, int defStyleAttr) {
		super(context, attrs, defStyleAttr);
		// TODO Auto-generated constructor stub
	}

	public ThiredTextItemView(Context context, AttributeSet attrs) {
		super(context, attrs);
		initView(context);
		TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ThiredTextItemView);
		String itemName = a.getString(R.styleable.ThiredTextItemView_thiredTextItemName);
		String centerText = a.getString(R.styleable.ThiredTextItemView_thiredTextCenterText);
		String rightText = a.getString(R.styleable.ThiredTextItemView_thiredTextRightText);
		setItemName(itemName);
		setCentertext(centerText);
		setRighttext(rightText);
		// Constants.changeSize(context, this, true);
	}

	public void setRighttext(String rightText) {
		rightItem.setText(rightText);

	}

	public void setCentertext(String centerText) {
		centerItem.setText(centerText);
	}

	/**
	 * 设置条目
	 * 
	 * @param itemName
	 * 
	 * @author lkx Created at 2015-10-5 上午9:14:08
	 */
	public void setItemName(String itemName) {
		ThreeTextviewItem.setText(itemName);

	}

	public ThiredTextItemView(Context context) {
		super(context);
		initView(context);
	}

	/**
	 * 初始化绑定控件
	 * 
	 * @param context
	 * 
	 * @author lkx Created at 2015-10-5 上午8:58:56
	 */
	private void initView(Context context) {
		View view = View.inflate(context, R.layout.infox_myview_three_text, this);
		ThreeTextviewItem = (TextView) view.findViewById(R.id.mThreeTextviewItem);
		centerItem = (TextView) view.findViewById(R.id.mCenterTextview);
		rightItem = (TextView) view.findViewById(R.id.mRightTextview);
		ThreeTextviewItem.setTextSize(16.0f);
		centerItem.setTextSize(14.0f);
		rightItem.setTextSize(14.0f);
	}

}
